package cn.ceplc.nlu.admin.domain;

import cn.ceplc.nlu.base.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

@Entity
@Data
@EqualsAndHashCode(callSuper = false)
public class Role extends BaseEntity<Long> {


    private static final long serialVersionUID = 7996926301308172920L;

    private String name;

    @JsonIgnore
    @OneToMany(cascade = {CascadeType.REMOVE}, fetch = FetchType.LAZY, mappedBy = "role")
    private List<User> users;

    @JsonIgnore
    @OneToMany(cascade = {CascadeType.REMOVE}, fetch = FetchType.LAZY, mappedBy = "role")
    private List<Menu> menus;
}
